#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6;

ll n, s, sum1, sum2, arr, mycount;

struct node {
    ll x, y;
} a[N];

ll fac1(node a, node b) {
    return a.x * b.y;
}

void fac2(node& a, ll S) {
    ll groupTrainTimes = a.y / S;
    a.y -= groupTrainTimes * S;
}

ll fac3(node a) {
    return a.y;
}

bool cmp(node a, node b) {
    return a.x > b.x;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> s;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i].x >> a[i].y;
    }
    sort(a + 1, a + 1 + n, cmp);
    ll totalCost = 0;
    for (int i = 1; i <= n; ++i) {
        ll groupTrainTimes = a[i].y / s;
        ll individualTrainTimes = a[i].y % s;
        totalCost += groupTrainTimes * s + individualTrainTimes * a[i].x;
    }
    cout << totalCost << endl;
    return 0;
}
